์ž‘์„ฑ: 2024-11-27 06:30:34
    ์ˆ˜์ •: 2024-11-27 06:30:34

    Nginx Proxy Manager ์„ค์น˜

    Nginx Proxy Manager๋Š” Nginx๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•œ ์‚ฌ์šฉ์ž ์นœํ™”์ ์ธ ์›น ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ œ๊ณตํ•˜๋Š” ํ”„๋ก์‹œ ๊ด€๋ฆฌ ๋„๊ตฌ์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ์›น์‚ฌ์ดํŠธ์™€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‰ฝ๊ฒŒ ๊ด€๋ฆฌํ•˜๊ณ , SSL ์ธ์ฆ์„œ์™€ ๊ฐ™์€ ๊ธฐ๋Šฅ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜๋Š” Nginx Proxy Manager๋ฅผ ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

    1. Docker ๋ฐ Docker Compose ์„ค์น˜

    Nginx Proxy Manager๋Š” Docker๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Docker์™€ Docker Compose๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์„ค์น˜๋˜์ง€ ์•Š์•˜๋‹ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

    a. Docker ์„ค์น˜

    # Ubuntu์— Docker ์„ค์น˜
    sudo apt update
    sudo apt install -y docker.io
     
    # Docker ์„œ๋น„์Šค ์‹œ์ž‘ ๋ฐ ๋ถ€ํŒ… ์‹œ ์ž๋™ ์‹œ์ž‘ ์„ค์ •
    sudo systemctl start docker
    sudo systemctl enable docker

    b. Docker Compose ์„ค์น˜

    # Docker Compose ์„ค์น˜
    sudo apt install -y docker-compose

    2. Nginx Proxy Manager ์„ค์ •

    1. ์ž‘์—… ๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ

    Nginx Proxy Manager๋ฅผ ์œ„ํ•œ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

    mkdir ~/nginx-proxy-manager
    cd ~/nginx-proxy-manager
    1. Docker Compose ํŒŒ์ผ ์ž‘์„ฑ

    docker-compose.yml ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜๊ณ  ์•„๋ž˜ ๋‚ด์šฉ์„ ๋ถ™์—ฌ๋„ฃ์Šต๋‹ˆ๋‹ค.

    version: '3'
     
    services:
      app:
        image: jc21/nginx-proxy-manager:latest
        container_name: nginx-proxy-manager
        restart: unless-stopped
        ports:
          - "80:80"     # HTTP ํฌํŠธ
          - "443:443"   # HTTPS ํฌํŠธ
          - "81:81"     # ์›น ์ธํ„ฐํŽ˜์ด์Šค ํฌํŠธ
        volumes:
          - ./data:/data
          - ./letsencrypt:/etc/letsencrypt
        environment:
          DB_SQLITE_FILE: "/data/database.sqlite"
    1. Docker Compose ์‹คํ–‰

    ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด Nginx Proxy Manager๋ฅผ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

    docker-compose up -d

    3. Nginx Proxy Manager ์ ‘์†

    Nginx Proxy Manager๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์‹คํ–‰๋˜๋ฉด ์›น ๋ธŒ๋ผ์šฐ์ €๋ฅผ ์—ด๊ณ  ์•„๋ž˜ URL์— ์ ‘์†ํ•ฉ๋‹ˆ๋‹ค.

    http://<์„œ๋ฒ„ IP>:81
    

    4. ๊ธฐ๋ณธ ๋กœ๊ทธ์ธ

    ์ฒซ ๋กœ๊ทธ์ธ ํ›„, ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

    5. SSL ์ธ์ฆ์„œ ์„ค์ •

    Nginx Proxy Manager์—์„œ SSL ์ธ์ฆ์„œ๋ฅผ ์‰ฝ๊ฒŒ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. "SSL Certificates" ์„น์…˜์—์„œ Let's Encrypt๋ฅผ ์ด์šฉํ•œ ๋ฌด๋ฃŒ ์ธ์ฆ์„œ๋ฅผ ๋ฐœ๊ธ‰๋ฐ›๊ฑฐ๋‚˜, ์ˆ˜๋™์œผ๋กœ SSL ์ธ์ฆ์„œ๋ฅผ ์—…๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    6. ๋ฆฌ๋ฒ„์Šค ํ”„๋ก์‹œ ์„ค์ •

    Nginx Proxy Manager์˜ ๋Œ€์‹œ๋ณด๋“œ์—์„œ "Proxy Hosts" ์„น์…˜์œผ๋กœ ๊ฐ€์„œ ์ƒˆ๋กœ์šด ํ”„๋ก์‹œ ํ˜ธ์ŠคํŠธ๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ ๋‹ค์Œ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค:

    • Domain Names: ์‚ฌ์šฉํ•  ๋„๋ฉ”์ธ ์ด๋ฆ„
    • Scheme: HTTP ๋˜๋Š” HTTPS
    • Forward Hostname / IP: ์‹ค์ œ ์„œ๋ฒ„์˜ IP ์ฃผ์†Œ ๋˜๋Š” ํ˜ธ์ŠคํŠธ ์ด๋ฆ„
    • Forward Port: ์‹ค์ œ ์„œ๋ฒ„์˜ ํฌํŠธ ๋ฒˆํ˜ธ

    ์ด ์™ธ์—๋„ ์ถ”๊ฐ€์ ์ธ ์„ค์ •(SSL, Access List ๋“ฑ)์„ ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ๊ฒฐ๋ก 

    Nginx Proxy Manager๋Š” Docker๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‰ฝ๊ฒŒ ์„ค์น˜ํ•˜๊ณ  ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ•๋ ฅํ•œ ๋„๊ตฌ์ž…๋‹ˆ๋‹ค. ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ด€๋ฆฌํ•˜๊ณ , SSL ์ธ์ฆ์„œ๋ฅผ ์ ์šฉํ•˜๋ฉฐ, ํ”„๋ก์‹œ ์„ค์ •์„ ์‰ฝ๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.